package vn.egame.elockscreen;

import com.dev.dream.libs.preperences.DevDreamPreferenceManager;

import android.content.Context;

public class ELockscreenPreferences {
	// Handle for the LiveWallpaperPreferences singleton instance
	private static ELockscreenPreferences INSTANCE;
	public static final String LOCKER_PACKAGE_TEMPLATE = "vn.evui.launcher.locker.ev_";
	public static final int HANDLER_FINISH = 1;
	public static final int VIBRATE = 2;
	public static final int UNLOCK = 3;
	public static final int VISIBLE = 4;

	// String containing the live wallpaper's preferences name
	public static final String PREFERENCE_NAME = "vn.egame.elockscreen";

	public static final String KEY_ENABLE_LOCKSCREEN = "ENABLE_LOCKSCREEN";
	private static final boolean DEFAULT_ENABLE_LOCK = true;

	public static final String KEY_ENABLE_PASSCODE = "KEY_ENABLE_PASSCODE";
	private static final boolean DEFAULT_ENBALE_PASSCODE = false;

	public static final String KEY_VALUE_PASSCODE = "KEY_VALUE_PASSCODE";
	private static final String DEFAULT_VALUE_PASSCODE = "";

	public static final String KEY_PATH_LOCK_THEME = "KEY_PATH_LOCK_THEME";
	private static final String DEFAULT_PATH_LOCK_THEME = "";

	public static final String KEY_LOCKER_PACKAGE_TEMPLATE_THEME = "KEY_LOCKER_PACKAGE_TEMPLATE_THEME";
	private static final String DEFAULT_LOCKER_PACKAGE_TEMPLATE_THEME = "0";

	private String pathLockTheme;

	private boolean isShowGuid, enableLockscreen;

	private boolean isEnablePasscode;
	private String valuePasscode;

	private String lockerPackageTemplate;

	ELockscreenPreferences() {
		// Do nothing...
	}

	// Obtain the LiveWallpaperPreferences instance
	public static ELockscreenPreferences getInstance() {
		if (INSTANCE == null) {
			INSTANCE = new ELockscreenPreferences();
		}
		return INSTANCE;
	}

	DevDreamPreferenceManager exoChatPreferenceManager;

	// Initialize the wallpaper's preference file
	public void initPreferences(Context pContext) {

		exoChatPreferenceManager = new DevDreamPreferenceManager(pContext,
				PREFERENCE_NAME);

		enableLockscreen = exoChatPreferenceManager.getBoolean(
				KEY_ENABLE_LOCKSCREEN, DEFAULT_ENABLE_LOCK);

		isEnablePasscode = exoChatPreferenceManager.getBoolean(
				KEY_ENABLE_PASSCODE, DEFAULT_ENBALE_PASSCODE);

		valuePasscode = exoChatPreferenceManager.getString(KEY_VALUE_PASSCODE,
				DEFAULT_VALUE_PASSCODE);

		pathLockTheme = exoChatPreferenceManager.getString(KEY_PATH_LOCK_THEME,
				DEFAULT_PATH_LOCK_THEME);

		lockerPackageTemplate = exoChatPreferenceManager.getString(
				KEY_LOCKER_PACKAGE_TEMPLATE_THEME,
				DEFAULT_LOCKER_PACKAGE_TEMPLATE_THEME);

	}

	public boolean isEnableLockscreen() {
		return enableLockscreen;
	}

	public void setEnableLockscreen(boolean enableLockscreen) {
		this.enableLockscreen = enableLockscreen;
		exoChatPreferenceManager.putBoolean(KEY_ENABLE_LOCKSCREEN,
				this.enableLockscreen);

	}

	public boolean isEnablePasscode() {
		return isEnablePasscode;
	}

	public void setEnablePasscode(boolean isEnablePasscode) {
		this.isEnablePasscode = isEnablePasscode;
		this.exoChatPreferenceManager.putBoolean(KEY_ENABLE_PASSCODE,
				isEnablePasscode);
	}

	public String getValuePasscode() {
		return valuePasscode;
	}

	public void setValuePasscode(String valuePasscode) {
		this.valuePasscode = valuePasscode;
		this.exoChatPreferenceManager.putString(KEY_VALUE_PASSCODE,
				valuePasscode);
	}

	public String getPathLockTheme() {
		return pathLockTheme;
	}

	public void setPathLockTheme(String pathLockTheme) {
		this.pathLockTheme = pathLockTheme;
		this.exoChatPreferenceManager.putString(KEY_PATH_LOCK_THEME,
				pathLockTheme);
	}

	public String getLockerPackageTemplate() {
		return lockerPackageTemplate;
	}

	public void setLockerPackageTemplate(String lockerPackageTemplate) {
		this.lockerPackageTemplate = lockerPackageTemplate;
		this.exoChatPreferenceManager.putString(
				KEY_LOCKER_PACKAGE_TEMPLATE_THEME, lockerPackageTemplate);
	}

}
